package com.ex;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * 异常解析器
 */
@ControllerAdvice
public class MyHandlerException {

    @ExceptionHandler({
            AuthorizationException.class
    })
    public ModelAndView handlerAuthorizationException(AuthorizationException e){
        e.printStackTrace();
        ModelAndView mv = new ModelAndView();
        mv.setViewName("redirect:/login.html");
        return mv;
    }
}